﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Models;
using PetaPoco;

namespace DAL.MySQL
{
    public class logDAL
    {
        public Database db = DbScoure.DataBase();
        public logEntity Save(logEntity model)
        {
            db.Save("log", "ID", model);
            return model;
        }

        public Page<logEntity> GetPageList(int pagenum, int pagesize, string where, string order, params object[] args)
        {
            var pagelist = db.Page<logEntity>(pagenum, pagesize, "select * from log where 1=1 " + where + " order by " + order + " ,ID desc", args);
            return pagelist;
        }

        public bool Del()
        {
            try
            {
                db.Execute("delete from log where "+ Com.MysqlSqlite.Ntianqian(7));
                return true;
            }
            catch (Exception)
            {
                return false;
            }
        }

    }
}
